<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$website_name}</title>
<link href="{$templates_root}/style/style_pubilc.css" rel="stylesheet" type="text/css" />
<link href="{$templates_root}/style/style_guestbook.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{$templates_root}/script/jquery-1.7.1.js"></script>
<script type="text/javascript" src="{$templates_root}/script/pubilc.js"></script>
<script type="text/javascript" src="{$templates_root}/plugin/xheditor-1.1.12/xheditor-1.1.12-zh-cn.min.js"></script>
<!--[if IE 6]>
	<script src="//letskillie6.googlecode.com/svn/trunk/2/zh_CN.js"></script>
<![endif]-->
{literal}
<script type="text/javascript">
$(document).ready(function(e) {
    $('#submit').click(function(e){
		var author_v = $('#author').val();
		var email_v = $('#email').val();
		var content_v = $('#content').val();
		switch (''){
			case author_v:
				alert('请写下你的大名~');
				return false;
				break;
			case email_v:
				alert('请留下你的email~');
				return false;
				break;
			case content_v:
				alert('留几句话吧~');
				return false;
				break;
			default:
				break;
			}
		$('.page_bar').load('guestbook_dl.php',{author:author_v,email:email_v,content:content_v}
			,function(){
				$('#ajax_mark').next(this).find('.guestbook_panel').eq(0).prepend('<div class="msg_item"><dl><dt><div class="l_title"><span>作者：</span>'+author_v+'</div></dt><dd>'+content_v+'</dd></dl></div>');
				alert('留言成功~！');

			});

		});
});

</script>
{/literal}
</head>

<body>
<div class="box"> {include file='header.tpl'}
  <div class="main">
    <div class="main_top">
      <div class="main_icon">
        <div class="main_title">
          <h1>{$guestbook_title}</h1>
        </div>
        <div class="main_text">
          {$guestbook_text}
        </div>
      </div>
    </div>
    <div class="main_bottom">
      <div class="msg_list">
        <div class="main_b_title" id="ajax_mark">
          <h2>留言列表</h2>
        </div>
        <div class="guestbook_panel">
        <div class="guestbook_panel">
        {section name=key loop=$msg_arr}
        <div class="msg_item">
          <dl>
            <dt>
                <div class="l_title"><span>作者：</span>{$msg_arr[key].author}</div>
            </dt>
            <dd>{$msg_arr[key].content}</dd>
          </dl>
        </div>
        {/section}
        <div class="page_bar">{$pageBar}</div>
       	</div>
        <a id="bd_msg" href="javascript:;"><img src="{$templates_root}/images/msg_btn_05.png" width="142" height="46" /></a>
        <div class="edit_form">
        <form method="post">
          <table border="0" cellpadding="0" cellspacing="10">
            <tr>
              <td><label for="textfield">作者：</label>
                <input type="text" id="author" /></td>
              <td><label for="textfield2">Email：</label>
                <input type="text" id="email" />&nbsp;(将保密，不予显示)</td>
            </tr>
            <tr>
              <td colspan="2"><label for="textarea"></label>
                <textarea style="color:#FFF;" id="content" class="xheditor {literal}{tools:'mini',cleanPaste:3,internalStyle:false,inlineStyle:false}{/literal}" cols="80" rows="7"></textarea></td>
            </tr>
            <tr>
              <td><input type="button" id="submit" value="发表留言" /></td>
              <td>&nbsp;</td>
            </tr>
          </table>
        </form>
      </div>
      	{literal}
        <script type="text/javascript">
        	$('#bd_msg').click(function(e) {
                $('.edit_form').animate({height:'toggle'},500);
            });
        </script>
        {/literal}
      	</div>
      </div>

      <div class="clear"></div>
    </div>
  </div>
  {include file='footer.tpl'}
</div>
</body>
</html>
